// components/custom-modal/index.js
Component({
  properties: {
    show: { // 是否显示模态框（通过父组件控制）
      type: Boolean,
      value: false
    },
    title: { type: String, value: '提示' },
    content: { type: String, value: '' },
    showCancel: { type: Boolean, value: true }, // 是否显示取消按钮
    confirmText: { type: String, value: '确定' },
    cancelText: { type: String, value: '取消' }
  },
  methods: {
    // 关闭模态框（触发父组件事件）
    handleClose() {
      this.triggerEvent('close', { action: 'close' });
    },
    handleConfirm() {
      this.triggerEvent('confirm', { action: 'confirm' });
    },
    handleCancel() {
      this.triggerEvent('cancel', { action: 'cancel' });
    }
  }
});